package com.example.smartcity_poverty.ui.AllService.JobSearch.adapter

import android.content.Intent
import com.example.smartcity_poverty.Base.BaseRecyclerAdapter
import com.example.smartcity_poverty.logic.ServiceBean.JobSearchBean.JsListModel
import com.example.smartcity_poverty.ui.AllService.JobSearch.activtiy.JsShowListActivity
import kotlinx.android.synthetic.main.re_js_list.*

/**
 *  created by ikun
 *  ANDROID STUDIO - version 4.0
 *  email: jinkunwei41@gmail.com
 * --------------------------------
 *
 **/
class JsListAdapter(
    val list: MutableList<JsListModel.RowsBean>,
    layoutId: Int
) : BaseRecyclerAdapter<JsListModel.RowsBean>(list, layoutId) {
    override fun setData(
        view: BaseViewHolder.ViewFind,
        data: JsListModel.RowsBean,
        position: Int,
        holder: BaseViewHolder
    ) {
        val d = list[position]
        val fv = holder.viewFind
        val con = holder.viewFind.view?.context

        fv.jsListTitle.text = d.name
        fv.jsListAll.text = "岗位职责: ${d.obligation}"
        fv.jsListThis.text = "公司地点: ${d.address}"
        fv.jsListMoney.text = "${d.salary}k"

        holder.itemView.setOnClickListener {
            con?.startActivity(
                Intent(con, JsShowListActivity::class.java).putExtra(
                    "id",
                    d.id.toString()
                )
            )
        }
    }
}